# -*- coding: utf-8 -*-
"""
summary:
    admin
license:
    GNU General Public License v3 <http://www.gnu.org/licenses/gpl.html>
authors:
    Jason Lee <huacnlee@gmail.com>
"""

from django.contrib import admin
from apps.blog.models import License,Profile,Post,Category,Tag,Comment
from apps.models import ADMIN_PAGE_SIZE

class LicenseAdmin(admin.ModelAdmin):
    list_display = ('id','name')
    list_display_links = ('id','name')
    list_per_page = ADMIN_PAGE_SIZE

class ProfileAdmin(admin.ModelAdmin):
    list_display = ('id','title','slug','sub_title')
    list_display_links = ('title','slug','sub_title')
    list_per_page = ADMIN_PAGE_SIZE    
    

class CategoryAdmin(admin.ModelAdmin):
    list_display = ('id','name','slug')
    list_display_links = ('name','slug')
    list_per_page = ADMIN_PAGE_SIZE


class TagAdmin(admin.ModelAdmin):
    list_display = ('id','name')
    list_display_links = ('id','name')
    list_per_page = ADMIN_PAGE_SIZE


class PostAdmin(admin.ModelAdmin):
    list_display = ('id','title','addtime_format','status')
    list_display_links = ('title',)
    list_per_page = ADMIN_PAGE_SIZE
    
    class Media:
        js = (
              '/static/scripts/lib/jquery.js',
              '/static/scripts/lib/components.js',
              '/static/scripts/lib/utils.js',
              '/static/scripts/lib/tiny_mce/tiny_mce.js',
              '/static/scripts/admin/pagebase.js',
        )
        
class CommentAdmin(admin.ModelAdmin):
    list_display = ('id','name','email','body','addtime')
    list_display_links = ('name','body')
    list_per_page = ADMIN_PAGE_SIZE


admin.site.register(License, LicenseAdmin)
admin.site.register(Profile,ProfileAdmin)
admin.site.register(Category, CategoryAdmin)
admin.site.register(Tag,TagAdmin)
admin.site.register(Post,PostAdmin)
admin.site.register(Comment,CommentAdmin)